package com.nl.model.exception;



import java.util.StringJoiner;

/**
 * 系统异常.
 *
 * @author breggor
 */
public class SystemException extends BaseException {
    private static final long serialVersionUID = 1;

    private static final int DEFAULT_CODE = -1;

    public SystemException(final String message) {
        this(message, DEFAULT_CODE);
    }

    public SystemException(final Throwable e) {
        this(e, DEFAULT_CODE);
    }

    public SystemException(final String message, final int code) {
        super(message, code);
    }

    public SystemException(final String message, final Throwable e) {
        super(message, e, DEFAULT_CODE);
    }

    public SystemException(final String message, final Throwable e, final int code) {
        super(message, e, code);
    }

    public SystemException(final Throwable e, final int code) {
        super(e, code);
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", SystemException.class.getSimpleName() + "[", "]")
            .add("code=" + getCode()).add("message=" + super.getMessage())
            .toString();
    }
}
